CoffeeShopCrypto Supertrend Liquidity EngineMost SuperTrend indicators use fixed ATR multipliers that ignore contextโforcing traders to constantly tweak settings that rarely adapt well across timeframes or assets.
This Supertrend is a nodd to and a more completion of the work
done by Olivier Seban ( @olivierseban )
This version replaces guesswork with an adaptive factor based on prior session volatility, dynamically adjusting stops to match current conditions. It also introduces liquidity-aware zones, real-time strength histograms, and a visual control panelโmaking your stoploss smarter, more responsive, and aligned with how the market actually moves.
๐ The Multiplier Problem & Adaptive Factor Solution
Traditional SuperTrend indicators rely on fixed ATR multipliersโoften arbitrary numbers like 1.5, 2, or 3. The issue? No logical basis ties these values to actual market conditions. What works on a 5-minute Nasdaq chart fails on a daily EUR/USD chart. Traders spend hours tweaking multipliers per asset, timeframe, or volatility phaseโand still end up with stoplosses that are either too tight or too loose. Worse, the market doesnโt care about your settingโit behaves according to underlying volatility, not your parameter.
This version fixes that by automating the multiplier selection entirely. It uses a 4-zone model based on the current ATR relative to the previous sessionโs ATR, dynamically adjusting the SuperTrend factor to match current volatility. It eliminates guesswork, adapts to the asset and timeframe, and ensures youโre always using a context-aware stoplossโone that evolves with the market instead of fighting it.
ATR EXAMPLE
Letโs say prior session ATR = 2.00
Now suppose current ATR = 0.32
This places us in Zone 1 (Very Low Volatility)
It doesnโt imply "overbought" or "oversold" โ it tells you the market is moving very little, which often means:
Lower risk | Smaller stops | Smaller opportunities (and losses)
๐ Liquidity Zones vs. Arbitrary Pullbacks
The standard SuperTrend stop loss line often looks like price โbarely misses itโ before continuing its trend. Traders call this "stop hunting," but whatโs really happening is liquidity collectionโprice pulls back into a zone rich in orders before continuing. The problem? The old SuperTrend doesnโt show this zone. It only draws the outer limit, leaving no visual cue for where entries or continuation moves might realistically originate.
This script introduces 2 levels in the Liquidity Zone. One for Support and one for Stophunts, which draw dynamically between the current price and the SuperTrend line. These levels reflect where the market is most likely to revisit before resuming the trend. By visualizing the area just above the Supertrend stop loss, you can anticipate pullbacks, spot ideal re-entries, and avoid premature exits. This bridges the gap between mechanical stoploss logic and real-world liquidity behavior.
โณ Prior Session ATR vs. Live ATR
Using real-time ATR to determine movement potential is like driving by looking in your rearview mirror. Itโs reactive, not predictive. Traders often base decisions on live ATR, unaware that todayโs range is still unfolding โcreating volatility mismatches between whatโs calculated and what actually matters. Since ATR reflects range, calculating it mid-session gives an incomplete and misleading picture of true volatility.
Instead, this system uses the ATR from the previous session , anchoring your volatility assumptions in a fully-formed price structure . It tells you how far price moved in the last full market phaseโbe it London, New York, or Tokyoโgiving you a more reliable gauge of expected range today. This is a smarter way to estimate how far price could move rather than how far it has moved.
The Smoothing function will take the ATR, Support, Resistance, Stophunt Levels, and the Moving Avearage and smooth them by the calculation you choose.
It will also plot a moving average on your chart against closing prices by the smoothing function you choose.
๐งญ Scalping vs. Trending Modes
The market moves in at least 4 phases. Trending, Ranging, Consolidation, Distribution.
Every trader has a different style โsome scalp low-volatility moves during off-hours, while others ride macro trends across days. The problem with classic SuperTrend? It treats every market condition the same. A fixed system canโt possibly provide proper stoploss spacing for both a fast scalp and a long-term swing. Traders are forced to rebuild their system every time the market changes character or the session shifts.
This version solves that with a simple toggle:
Scalping or Trend Mode . With one switch, it inverts the logic of the adaptive factor to either tighten or loosen your trailing stops. During low-liquidity hours or consolidation phases, Scalping Mode offers snug stoplosses. During expansion or clear directional bias.
Trend Mode lets the trade breathe. This is flexibility built directly into the logicโnot something you have to recalibrate manually.
๐ Histogram Oscillator for Move Strength
In legacy indicators, thereโs no built-in way to gauge when the move is losing power . Traders rely on price action or momentum indicators to guess if a trend is fading. But this adds clutter, lag, and often contradiction. The classic SuperTrend doesnโt offer insight into how strong or weak the current trend leg isโonly whether price has crossed a line.
This version includes a Trending Liquidity Histogram โa histogram that shows whether the liquidity in the SuperTrend zone is expanding or compressing. When the bars weaken or cross toward zero, it signals liquidity exhaustion . This early warning gives you time to prep for reversals or anticipate pullbacks. It even adapts visually depending on your trading mode, showing color-coded signals for scalping vs. trending behavior. It's both a strength gauge and a trade timing toolโbuilt into your stoploss logic.
Histogram in Scalping Mode
Histogram in Trending Mode
๐ Visual Table for Real-Time Clarity
A major issue with custom indicators is opacity โyou donโt always know what settings or values are currently being used. Even worse, if your dynamic logic changes mid-trade, you may not notice unless you go digging into the code or logs. This can create confusion, especially for discretionary traders.
This SuperTrend solves it with a clean visual summary table right on your chart. It shows your current ATR value, adaptive multiplier, trailing stop level, and whether a new zone size is active. That means no surprises and no second-guessingโeverything important is visible and updated in real-time.
Cari dalam skrip untuk "stop loss"
Zero Lag MACD + Kijun-sen + EOM StrategyThis strategy offers a robust approach to identifying high-probability trading opportunities in the fast-paced cryptocurrency markets, particularly on lower timeframes (e.g., 5-minute). It leverages the synergistic power of three distinct indicators to confirm entries, ensuring a disciplined approach to risk management.
Key Components:
Zero Lag MACD Enhanced Version 1.2: This core momentum indicator is used to identify precise shifts in trend and momentum, offering reduced lag compared to traditional MACD. Entry signals are filtered based on the histogram's position (below for buys, above for sells) to enhance signal reliability.
Kijun-sen (Ichimoku Cloud): Acting as a dynamic support/resistance and trend filter, the Kijun-sen line confirms the prevailing market direction. Long entries are confirmed when price is above Kijun-sen, and short entries when price is below.
Ease of Movement (EoM): This volume-based oscillator provides crucial confirmation of price movements by measuring the ease with which price changes. Positive EoM confirms buying pressure, while negative confirms selling pressure, adding an essential layer of validation to trade setups.
How it Works:
The strategy generates entry signals only when all three indicators align simultaneously:
For Long Entries: A Zero Lag MACD buy signal (crossover below histogram) must coincide with price trading above the Kijun-sen, and the Ease of Movement indicator being above its zero line.
For Short Entries: A Zero Lag MACD sell signal (crossover above histogram) must coincide with price trading below the Kijun-sen, and the Ease of Movement indicator being below its zero line.
Entries are executed at the open of the candle immediately following the signal confirmation.
Risk Management:
Disciplined risk management is paramount to this strategy:
Dynamic Stop-Loss: An Average True Range (ATR) based stop-loss is implemented, set at 2.5 times the current ATR. This adapts the stop-loss distance to market volatility, ensuring sensible risk sizing.
Fixed Take-Profit: A consistent Risk-to-Reward (R:R) ratio of 1:1.2 is applied for all trades, promoting stable profit realization.
Customization & Optimization:
The strategy is built with fully customizable input parameters for each indicator (MACD lengths, Kijun-sen period, ATR period, ATR multiplier, and Risk-to-Reward ratio). This allows users to fine-tune the strategy for different assets, timeframes, and market conditions, facilitating robust backtesting and optimization.
Disclaimer: Trading involves substantial risk and is not suitable for all investors. Past performance is not indicative of future results. This strategy is provided for educational and informational purposes only. Always use proper risk management and conduct your own due diligence.
CVD Divergence & Volume ProfileThis Pine Script indicator, named "CVD Divergence & Volume Profile," is designed to identify potential trading opportunities by combining Cumulative Volume Delta (CVD) divergence with Volume Profile levels and an optional Simple Moving Average (SMA) trend filter. It plots signals directly on the price chart.
Here's a breakdown of what each component does and how to potentially trade with it:
1. Cumulative Volume Delta (CVD) Divergence
What it does: CVD measures the cumulative difference between buying and selling volume. A rising CVD indicates more buying pressure, while a falling CVD indicates more selling pressure. Divergence occurs when the price action contradicts the CVD's direction, suggesting a potential shift in momentum or trend reversal.
Bearish Divergence: The price makes a higher high, but the CVD makes a lower high (or fails to make a new high). This suggests that despite the price increasing, the underlying buying pressure is weakening.
Bullish Divergence: The price makes a lower low, but the CVD makes a higher low (or fails to make a new low). This suggests that despite the price decreasing, the underlying selling pressure is weakening.
Visualization:
Red triangle pointing down on the chart indicates a Bearish Divergence signal.
Green triangle pointing up on the chart indicates a Bullish Divergence signal.
2. Volume Profile Levels (VAH, VAL, POC)
What it does: The indicator calculates simplified Volume Profile levels over a user-defined vp_range (number of candles). These levels represent areas where significant trading activity has occurred:
VAH (Value Area High): The upper boundary of the "Value Area," where 70% of the volume traded.
VAL (Value Area Low): The lower boundary of the "Value Area," where 70% of the volume traded.
POC (Point of Control): The price level within the vp_range where the most volume was traded.
Significance: These levels often act as significant support and resistance zones.
Visualization:
Orange lines for VAH and VAL.
Yellow line for POC.
Zone Proximity (zone_thresh): The indicator only generates divergence signals if the current close price is within a specified percentage zone_thresh of either VAH, VAL, or POC. This filters signals to areas of high liquidity and potential turning points.
3. Trend Filter (SMA)
What it does: This is an optional filter (use_trend_filter) that uses a Simple Moving Average (sma_period, default 200).
Significance: It helps ensure that divergence signals are traded in alignment with the broader market trend, potentially increasing their reliability.
For long signals (bullish divergence), the price (close) must be above the SMA (indicating an uptrend).
For short signals (bearish divergence), the price (close) must be below the SMA (indicating a downtrend).
Visualization: A blue line on the chart representing the SMA.
How to Trade with It (Potential Strategies)
The indicator aims to provide high-probability entry points by combining multiple confirming factors. Here's how you might interpret and trade the signals:
Identify Divergence: Look for the triangle signals on your chart (red for bearish, green for bullish).
Confirm Proximity to Volume Profile Levels: The signal itself confirms that the price is near a significant Volume Profile level (VAH, VAL, or POC). These are areas where price often reacts.
Bullish Signal (Green Triangle): This suggests buying momentum is returning after a price decline, especially when the price is near VAL or POC, which might act as support.
Bearish Signal (Red Triangle): This suggests selling momentum is increasing after a price rally, especially when the price is near VAH or POC, which might act as resistance.
Check Trend Alignment (SMA Filter):
For a long trade: You would ideally want to see a green triangle (bullish divergence) while the price is above the blue SMA line. This indicates a bullish divergence confirming a potential bounce within an existing uptrend.
For a short trade: You would ideally want to see a red triangle (bearish divergence) while the price is below the blue SMA line. This indicates a bearish divergence confirming a potential rejection within an existing downtrend.
Entry and Exit Considerations:
Entry: Consider entering a trade on the candle where the signal appears, or on the subsequent candle for confirmation.
Stop Loss: For a long trade, a logical stop-loss could be placed below the lowest point of the divergence, or below the VAL/POC if the signal occurred near it. For a short trade, above the highest point of the divergence or VAH/POC.
Take Profit: Targets could be set at the opposite Volume Profile level, previous swing highs/lows, or using a fixed risk-reward ratio.
Example Trading Scenario:
Long Trade: You see a green triangle (bullish divergence) printed on the chart. You notice the price is currently at the VAL (orange line). You check the blue SMA line and confirm that the price is above it (uptrend). This confluence of factors (bullish divergence, support at VAL, and uptrend) provides a strong potential long entry signal. You might enter, place your stop loss just below VAL, and target VAH or the next resistance level.
Short Trade: You see a red triangle (bearish divergence). The price is at the VAH (orange line). The price is also below the blue SMA line (downtrend). This suggests a potential short entry. You might enter, place your stop loss just above VAH, and target VAL or the next support level.
Candle/Keltner Channels BUY SELLWhy Use Candlesticks?
They help traders visualize price action
Used in technical analysis and price pattern recognition (e.g., Doji, Engulfing, Hammer)
Assist in determining entry and exit points
Why Traders Use Keltner Channels?
Keltner Channels are widely used by traders for identifying trends, detecting volatility, and spotting trade opportunities.
1. Trend Identification
The middle line (EMA) shows the general trend.
If price consistently stays above the middle line, it indicates a strong uptrend.
If price stays below, it signals a downtrend.
Use: Traders follow the trend direction to enter trades in line with momentum.
2. Volatility Measurement
The width of the channel expands and contracts based on Average True Range (ATR).
Wider channels = high volatility, tighter channels = low volatility.
Use: Helps traders decide when to expect breakouts or calm periods.
3. Breakout Signals
A break above the upper band can signal a bullish breakout.
A break below the lower band can signal a bearish breakout.
Use: Traders use this for momentum trading and breakout entries.
4. Overbought/Oversold Conditions
Price touching or crossing the upper band may suggest it's overbought.
Price touching or crossing the lower band may suggest it's oversold.
Use: Traders combine this with RSI or MACD to confirm reversal setups.
5. Trade Entry and Exit
When price pulls back to the middle EMA during a trend, it may present a buy/sell opportunity.
Exits can also be planned if price returns inside the bands after a breakout.
Use: Helps with precise entry and exit timing.
6. Combines Well With Other Indicators
Commonly used with:
RSI (for confirmation)
MACD (for momentum)
Candlestick patterns (for price action signals)
Combining Candlestick Patterns with Keltner Channels gives traders a powerful method to confirm entries, spot reversals, and improve accuracy. Hereโs why this combination works so well:
1. Context for Candlestick Signals
Candlestick patterns (like doji, engulfing, or pin bars) show potential price reversals, but they need context to be reliable. Keltner Channels provide that context:
A bullish candlestick near the lower band suggests a stronger buy signal.
A bearish candlestick near the upper band strengthens a sell signal.
2. Filtering False Signals
Candlestick patterns occur frequently, and not all are meaningful.
The location within the Keltner Channel helps filter out weak or false patterns.
Example: A bullish engulfing candle outside the lower band = high-probability reversal.
3. Improved Entry Timing
Traders wait for a candlestick pattern confirmation when price touches or crosses a Keltner band.
This avoids premature entries and allows tighter stop-losses.
4. Better Risk-Reward Setup
Candlestick entry near channel extremes (upper/lower band) lets traders place stop-losses just beyond recent highs/lows.
The target can be the opposite side of the channel or the middle EMA.
5. Visual Simplicity
Keltner Channels + Candles are visually intuitive.
Even beginner traders can easily recognize:
Overextended candles near channel edges.
Confirmed breakouts or reversals.
This Timeframe 5 min : XAUUSD
Gold Breakout Strategy - RR 4Strategy Name: Gold Breakout Strategy - RR 4
๐ง Main Objective
This strategy aims to capitalize on breakouts from the Donchian Channel on Gold (XAU/USD) by filtering trades with:
Volume confirmation,
A custom momentum indicator (LWTI - Linear Weighted Trend Index),
And a specific trading session (8 PM to 8 AM Quebec time โ GMT-5).
It takes only one trade per day, either a buy or a sell, using a fixed stop-loss at the wick of the breakout candle and a 4:1 reward-to-risk (RR) ratio.
๐ Indicators Used
Donchian Channel
Length: 96
Detects breakouts of recent highs or lows.
Volume
Simple Moving Average (SMA) over 30 bars.
A breakout is only valid if the current volume is above the SMA.
LWTI (Linear Weighted Trend Index)
Measures momentum using price differences over 25 bars, smoothed over 5.
Used to confirm trend direction:
Buy when LWTI > its smoothed version (uptrend).
Sell when LWTI < its smoothed version (downtrend).
โฐ Time Filter
The strategy only allows entries between 8 PM and 8 AM (GMT-5 / Quebec time).
A timestamp-based filter ensures the system recognizes the correct trading session even across midnight.
๐ Entry Conditions
๐ข Buy (Long)
Price breaks above the previous Donchian Channel high.
The current channel high is higher than the previous one.
Volume is above its moving average.
LWTI confirms an uptrend.
The time is within the trading session (20:00 to 08:00).
No trade has been taken yet today.
๐ด Sell (Short)
Price breaks below the previous Donchian Channel low.
The current channel low is lower than the previous one.
Volume is above its moving average.
LWTI confirms a downtrend.
The time is within the trading session.
No trade has been taken yet today.
๐ธ Trade Management
Stop-Loss (SL):
For long entries: placed below the wick low of the breakout candle.
For short entries: placed above the wick high of the breakout candle.
Take-Profit (TP):
Set at a fixed 4:1 reward-to-risk ratio.
Calculated as 4x the distance between the entry price and stop-loss.
No trailing stop, no break-even, no scaling in/out.
๐จ Visuals
Green triangle appears below the candle on a buy signal.
Red triangle appears above the candle on a sell signal.
Donchian Channel lines are plotted on the chart.
The strategy is designed for the 5-minute timeframe.
๐ One Trade Per Day Rule
Once a trade is taken (buy or sell), no more trades will be executed for the rest of the day. This prevents overtrading and limits exposure.
SuperTrade ST1 StrategyOverview
The SuperTrade ST1 Strategy is a long-only trend-following strategy that combines a Supertrend indicator with a 200-period EMA filter to isolate high-probability bullish trade setups. It is designed to operate in trending markets, using volatility-based exits with a strict 1:4 Risk-to-Reward (R:R) ratio, meaning that each trade targets a profit 4ร the size of its predefined risk.
This strategy is ideal for traders looking to align with medium- to long-term trends, while maintaining disciplined risk control and minimal trade frequency.
How It Works
This strategy leverages three key components:
Supertrend Indicator
A trend-following indicator based on Average True Range (ATR).
Identifies bullish/bearish trend direction by plotting a trailing stop line that moves with price volatility.
200-period Exponential Moving Average (EMA) Filter
Trades are only taken when the price is above the EMA, ensuring participation only during confirmed uptrends.
Helps filter out counter-trend entries during market pullbacks or ranges.
ATR-Based Stop Loss and Take Profit
Each trade uses the ATR to calculate volatility-adjusted exit levels.
Stop Loss: 1ร ATR below entry.
Take Profit: 4ร ATR above entry (1:4 R:R).
This asymmetry ensures that even with a lower win rate, the strategy can remain profitable.
Entry Conditions
A long trade is triggered when:
Supertrend flips from bearish to bullish (trend reversal).
Price closes above the Supertrend line.
Price is above the 200 EMA (bullish market bias).
Exit Logic
Once a long position is entered:
Stop loss is set 1 ATR below entry.
Take profit is set 4 ATR above entry.
The strategy automatically exits the position on either target.
Backtest Settings
This strategy is configured for realistic backtesting, including:
$10,000 account size
2% equity risk per trade
0.1% commission
1 tick slippage
These settings aim to simulate real-world conditions and avoid overly optimistic results.
How to Use
Apply the script to any timeframe, though higher timeframes (1H, 4H, Daily) often yield more reliable signals.
Works best in clearly trending markets (especially in crypto, stocks, indices).
Can be paired with alerts for live trading or analysis.
Important Notes
This version is long-only by design. No short positions are executed.
Ideal for swing traders or position traders seeking asymmetric returns.
Users can modify the ATR period, Supertrend factor, or EMA filter length based on asset behavior.
External Signals Strategy Tester v5External Signals Strategyย Testerย v5 โ User Guide (English)
1.โฏPurpose
This Pineย Script strategy is a universal backโtester that lets you plug in any external buy/sell series (for example, another indicator, webhook feed, or higherโtimeโframe condition) and evaluate a rich set of moneyโmanagement rules around it โ with a single click on/off workflow for every module.
2.โฏCore Workflow
Feed signals
Buyย Signal / Sellย Signal inputs accept any series (price, boolean, output of request.security(), etc.).
A crossover aboveย 0 is treated as โsignal firedโ.
Date filter
Startย Dateย /ย Endย Date restricts the test window so you can exclude unwanted history.
Trade engine
Optional Long / Short enable toggles.
Choose whether opposite signals simply close the trade or reverse it (flip direction in one transaction).
Risk modules โ all optโin via checkโboxes
Classic %ย block โ fixed % TakeโProfit / StopโLoss / BreakโEven.
Fibonacciย Bollingerย Bands (FBB) module
Draws dynamic VWMA/HMA/SMA/EMA/DEMA/TEMA midโline with ATRโscaled Fibonacci envelopes.
Every line can be used for stops, trailing, or multiโtarget exits.
Separate LONG and SHORT subโmodules
Each has its own SL plus three TakeโProfits (TP1โTP3).
Per TP you set line, positionโpercentage to close, and an optional trailing flag.
Executed TP/SLs deactivate themselves so they cannot refire.
Trailing behaviour
If Trail is checked, the selected line is reโevaluated once per bar; the order is amended via strategy.exit().
3.โฏInputs Overview
Group Parameter Notes
Tradeย Settings Enableย Long / Enableย Short Master switches
Closeย onย Opposite / Reverseย Position How to react to a counterโsignal
Riskย % Useย TP / SL / BE + their % Traditional fixedโdistance management
Fiboย Bands FIBOย LEVELSย ENABLE + visual style/length Turn indicator overlay on/off
FBBย LONGย SL / TP1โTP3 Enable, Line, %, Trail Rules applied only while a long is open
FBBย SHORTย SL / TP1โTP3 Enable, Line, %, Trail Rules applied only while a short is open
Line choices: Basis, 0.236, 0.382, 0.5, 0.618, 0.764, 1.0 โ long rules use lower bands, short rules use upper bands automatically.
4.โฏAlgorithm Details
Position open
On the very first bar after entry, the script checks the direction and activates the corresponding LONG or SHORT module, deactivating the other.
Order management loop (every bar)
FBB StopโLoss: placed/updated at chosen band; if trailing, follows the new value.
TP1โTP3: each active target updates its limit price to the selected band (or holds static if trailing is off).
The classic % block runs in parallel; its exits have priority because they call strategy.close_all().
Exit handling
When any strategy.exit() fires, the script reads exit_id and flips the *_Active flag so that order will not be recreated.
A StopโLoss (SL) also disables all remaining TPs for that leg.
5.โฏTypical Use Cases
Scenario Suggested Setup
Scalping longs into VWAPโreversion Enable LONG TP1 @โฏ0.382 (30โฏ%), TP2 @โฏ0.618 (40โฏ%), SL @โฏ0.236 + trailing
Fade shorts during news spikes Enable SHORT SL @โฏ1.0 (no trail) and SHORT TP1,2,3 on consecutive lowers with small sizeโouts
Classic trendโfollow Use only classic % TP/SL block and disable FBB modules
6.โฏHints & Tips
Signal quality matters โ this script manages exits, it does not generate entries.
Keep TV time zone in mind when picking start/end dates.
For portfolioโstyle testing allocate smaller default_qty_value than 100โฏ% or use strategy.percent_of_equity sizing.
You can combine FBB exits with fixedโ% ones for layered management.
7.โฏLimitations / Safety
No pyramiding; the script holds max one position at a time.
All calculations are barโclose; intraโbar touches may differ from realโtime execution.
The indicator overlay is optional, so you can run visualโclean tests by unchecking FIBOโฏLEVELSโฏENABLE.
[blackcat] L2 EMA NexusOVERVIEW
The L2 EMA Nexus is a comprehensive trading indicator that utilizes a three-tiered Exponential Moving Average (EMA) system to identify potential trading opportunities. This script combines technical analysis with robust risk management features to help traders make informed decisions.
KEY FEATURES
โข Triple EMA Analysis:
Customizable source inputs for each EMA
Adjustable length parameters (3, 8, 21 periods)
Dynamic color coding based on trend direction
Real-time price action monitoring
โข Advanced Entry Signals:
High-low price action verification
EMA cross-overs and cross-unders
Multi-timeframe trend confirmation
Dynamic position sizing limits
โข Risk Management:
Configurable Take Profit levels
Flexible Stop Loss settings
Optional TP/SL activation
Clear visual indicators for levels
HOW TO USE
Setup Initial Parameters:
Configure EMA lengths for your timeframe
Set Take Profit percentage (default 25%)
Define Stop Loss percentage (default 2.5%)
Adjust pyramiding limit as needed
Enable/Disable Features:
Toggle TP/SL settings based on strategy
Customize alert conditions
Modify visual labels for clarity
Monitor Trading Signals:
Watch for buy/sell labels
Track TP/SL levels
Monitor position status
TRADE MANAGEMENT
โข Entry Conditions:
Long Entry: Higher high with rising EMA1 and stable EMA3
Short Entry: Lower low with falling EMA1 and stable EMA2
โข Exit Conditions:
Take Profit: Price reaches defined percentage above/below entry
Stop Loss: Price reaches defined percentage below/above entry
โข Position Control:
Limited to specified number of positions
Automatic position tracking
Clear visual indication of current trades
TECHNICAL DETAILS
โข EMA Calculation:
Uses Exponential Moving Average for trend following
Color-coded based on 2-bar trend direction
Multiple timeframe compatibility
โข Label System:
Clear buy/sell markers
Take Profit and Stop Loss indicators
Real-time position status updates
โข Alert Configuration:
Customizable alert messages
Multiple alert conditions
Option to enable/disable specific alerts
LIMITATIONS
โ ๏ธ Important Considerations:
Results may vary across different market conditions
Historical performance does not guarantee future results
Always backtest strategy before live trading
Consider complementing with additional analysis tools
BEST PRACTICES
โข Recommended Timeframes:
Daily charts for long-term strategies
4-hour charts for swing trading
1-hour charts for short-term trading
โข Risk Management Tips:
Start with small position sizes
Always use TP/SL in live trading
Monitor market volatility before entering trades
TROUBLESHOOTING
โข Common Issues:
Ensure proper chart resolution
Verify alert conditions are enabled
Check for conflicting indicators
โข Performance Optimization:
Use appropriate timeframe for your strategy
Adjust indicator parameters based on market conditions
Monitor for potential overfitting
PEAD strategyโโ OVERVIEW
This strategy trades the classic post-earnings announcement drift (PEAD).
It goes long only when the market gaps up after a positive EPS surprise.
โโ LOGIC
1 โ Earnings filter โ EPS surprise > epsSprThresh โ%
2 โ Gap filter โ first regular 5-minute bar gaps โฅ gapThresh โ% above yesterdayโs close
3 โ Timing โ only the first qualifying gap within one trading day of the earnings bar
4 โ Momentum filter โ last perfDays trading-day performance is positive
5 โ Risk management
โโโข Fixed stop-loss: stopPct โ% below entry
โโโข Trailing exit: price < Daily EMA( emaLen )
โโ INPUTS
โข Gap up threshold (%) โ 1โ(gap size for entry)
โข EPS surprise threshold (%) โ 5โ(min positive surprise)
โข Past price performance โ 20โ(look-back bars for trend check)
โข Fixed stop-loss (%) โ 8โ(hard stop distance)
โข Daily EMA length โ 30โ(trailing exit length)
Note โ Back-tests fill on the second 5-minute bar (Pine limitation).
Live trading: enable calc_on_every_tick=true for first-tick entries.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ ๆฆ่ฆ๏ผๆฅๆฌ่ช๏ผ
ๆฌในใใฉใใธใผใฏๆฑบ็ฎๅพใฎ PEAD ใ็ใใ
EPS ใตใใฉใคใบใใใฉใน ใใค ๅฏไปใใฎใฃใใใขใใ ใ็บ็ใใ้ๆใในใคใณใฐใง่ฒทใๆใกใใพใใ
โโ ใญใธใใฏ
1 โ ๆฑบ็ฎใใฃใซใฟใผ โ EPS ใตใใฉใคใบ > epsSprThresh โ%
2 โ ใฎใฃใใใใฃใซใฟใผ โ ใฌใฎใฅใฉใผๆ้ๆๅใฎ 5 ๅ่ถณใๅๆฅ็ตๅค๏ผ gapThresh โ%ไปฅไธ
3 โ ใฟใคใใณใฐ โ ๆฑบ็ฎๅฝๆฅใพใใฏ็ฟๅถๆฅญๆฅใฎๆๅใฎใฎใฃใใใฎใฟใจใณใใชใผ
4 โ ใขใกใณใฟใ ใใฃใซใฟใผ โ ้ๅป perfDays ๅถๆฅญๆฅใฎ้จฐ่ฝ็ใใใฉใน
5 โ ใชในใฏ็ฎก็
โโโข ๅบๅฎในใใใ๏ผใจใณใใชใผ โ stopPct โ%
โโโข ๅฉ็ขบ๏ผ็ตๅคใๆฅ่ถณ EMA( emaLen ) ใไธๆใ
โโ ๅ
ฅๅใใฉใกใผใฟ
โข Gap up threshold (%) โ 1โ(ใฎใฃใใๆกไปถ)
โข EPS surprise threshold (%) โ 5โ(EPS ใตใใฉใคใบๆๅฐๅค)
โข Past price performance โ 20โ(ใใใฉใผใใณในๅคๅฎๆฅๆฐ)
โข Fixed stop-loss (%) โ 8โ(ๅบๅฎในใใใๅน
)
โข Daily EMA length โ 30โ(ๅฉ็ขบ็จ EMA ๆ้)
ๆณจๆ โ Pine ใฎไปๆงไธใใใใฏใในใใงใฏๅฏไปใ 5 ๅ่ถณใฎๆฌกใใผใง็ดๅฎใใพใใ
ๅฎ้็จใงๅฏไปใๆ่กใซๅใใใใๅ ดๅใฏ calc_on_every_tick=true ใๆๅนใซใใฆใใ ใใใ
โโโโ
ใๆ่ฆใ่ณชๅใใใใฐใๆฐ่ปฝใซใณใกใณใใใ ใใใ
Happy trading!
position_toolLibrary "position_tool"
Trying to turn TradingView's position tool into a library from which you can draw position tools for your strategies on the chart. Not sure if this is going to work
calcBaseUnit()
โโCalculates the chart symbol's base unit of change in asset prices.
โโReturns: (float) A ticks or pips value of base units of change.
calcOrderPipsOrTicks(orderSize, unit)
โโConverts the `orderSize` to ticks.
โโParameters:
โโโโ orderSize (float) : (series float) The order size to convert to ticks.
โโโโ unit (simple float) : (simple float) The basic units of change in asset prices.
โโReturns: (int) A tick value based on a given order size.
calcProfitLossSize(price, entryPrice, isLongPosition)
โโCalculates a difference between a `price` and the `entryPrice` in absolute terms.
โโParameters:
โโโโ price (float) : (series float) The price to calculate the difference from.
โโโโ entryPrice (float) : (series float) The price of entry for the position.
โโโโ isLongPosition (bool)
โโReturns: (float) The absolute price displacement of a price from an entry price.
calcRiskRewardRatio(profitSize, lossSize)
โโCalculates a risk to reward ratio given the size of profit and loss.
โโParameters:
โโโโ profitSize (float) : (series float) The size of the profit in absolute terms.
โโโโ lossSize (float) : (series float) The size of the loss in absolute terms.
โโReturns: (float) The ratio between the `profitSize` to the `lossSize`
createPosition(entryPrice, entryTime, tpPrice, slPrice, entryColor, tpColor, slColor, textColor, showExtendRight)
โโMain function to create a position visualization with entry, TP, and SL
โโParameters:
โโโโ entryPrice (float) : (float) The entry price of the position
โโโโ entryTime (int) : (int) The entry time of the position in bar_time format
โโโโ tpPrice (float) : (float) The take profit price
โโโโ slPrice (float) : (float) The stop loss price
โโโโ entryColor (color) : (color) Color for entry line
โโโโ tpColor (color) : (color) Color for take profit zone
โโโโ slColor (color) : (color) Color for stop loss zone
โโโโ textColor (color) : (color) Color for text labels
โโโโ showExtendRight (bool) : (bool) Whether to extend lines to the right
โโReturns: (bool) Returns true when position is closed
DI+/- Cross Strategy with ATR SL and 2% TPDI+/- Cross Strategy with ATR Stop Loss and 2% Take Profit
๐ Script Description for Publishing:
This strategy is based on the directional movement of the market using the Average Directional Index (ADX) components โ DI+ and DI- โ to generate entry signals, with clearly defined risk and reward targets using ATR-based Stop Loss and Fixed Percentage Take Profit.
๐ How it works:
Buy Signal: When DI+ crosses above 40, signaling strong bullish momentum.
Sell Signal: When DI- crosses above 40, indicating strong bearish momentum.
Stop Loss: Dynamically calculated using ATR ร 1.5, to account for market volatility.
Take Profit: Fixed at 2% above/below the entry price, for consistent reward targeting.
๐ง Why itโs useful:
Combines momentum breakout logic with volatility-based risk management.
Works well on trending assets, especially when combined with higher timeframe filters.
Clean BUY and SELL visual labels make it easy to interpret and backtest.
โ
Tips for Use:
Use on assets with clear trends (e.g., major forex pairs, trending stocks, crypto).
Best on 30m โ 4H timeframes, but can be customized.
Consider combining with other filters (e.g., EMA trend direction or Bollinger Bands) for even better accuracy.
ATM Option Selling StrategyATM Option Selling Strategy โ Explained
This strategy is designed for intraday option selling based on the 9/15 EMA crossover, 50/80 MA trend filter, and RSI 50 level. It ensures that all trades are exited before market close (3:24 PM IST).
. Indicators Used:
9 EMA & 15 EMA โ For short-term trend identification.
50 MA & 80 MA โ To determine the overall trend.
RSI (14) โ To confirm momentum (above or below 50 level).
2. Entry Conditions:
๐ด Sell ATM Call (CE) when:
Price is below 50 & 80 MA (Bearish trend).
9 EMA crosses below 15 EMA (Short-term trend turns bearish).
RSI is below 50 (Momentum confirms weakness).
๐ข Sell ATM Put (PE) when:
Price is above 50 & 80 MA (Bullish trend).
9 EMA crosses above 15 EMA (Short-term trend turns bullish).
RSI is above 50 (Momentum confirms strength).
3. Position Sizing & Risk Management:
Sell 375 quantity per trade (Lot size).
50-Point Stop Loss โ If option premium moves against us by 50 points, exit.
50-Point Take Profit โ If option premium moves in our favor by 50 points, book profit.
Exit all trades at 3:24 PM IST โ No overnight positions.
4. Exit Conditions:
โ
Stop Loss or Take Profit Hits โ Automatically exits based on a 50-point move.
โ
Time-Based Exit at 3:24 PM โ Ensures no open positions at market close.
Why This Works?
โ Trend Confirmation โ 50/80 MA ensures we only sell options in the direction of the market trend.
โ Momentum Confirmation โ RSI prevents entering weak trades.
โ Controlled Risk โ SL and TP protect against large losses.
โ No Overnight Risk โ All trades close before market close.
Supertrend + MACD CrossoverKey Elements of the Template:
Supertrend Settings:
supertrendFactor: Adjustable to control the sensitivity of the Supertrend.
supertrendATRLength: ATR length used for Supertrend calculation.
MACD Settings:
macdFastLength, macdSlowLength, macdSignalSmoothing: These settings allow you to fine-tune the MACD for better results.
Risk Management:
Stop-Loss: The stop-loss is based on the ATR (Average True Range), a volatility-based indicator.
Take-Profit: The take-profit is based on the risk-reward ratio (set to 3x by default).
Both stop-loss and take-profit are dynamic, based on ATR, which adjusts according to market volatility.
Buy and Sell Signals:
Buy Signal: Supertrend is bullish, and MACD line crosses above the Signal line.
Sell Signal: Supertrend is bearish, and MACD line crosses below the Signal line.
Visual Elements:
The Supertrend line is plotted in green (bullish) and red (bearish).
Buy and Sell signals are shown with green and red triangles on the chart.
Next Steps for Optimization:
Backtesting:
Run backtests on BTC in the 5-minute timeframe and adjust parameters (Supertrend factor, MACD settings, risk-reward ratio) to find the optimal configuration for the 60% win ratio.
Fine-Tuning Parameters:
Adjust supertrendFactor and macdFastLength to find more optimal values based on BTC's market behavior.
Tweak the risk-reward ratio to maximize profitability while maintaining a good win ratio.
Evaluate Market Conditions:
The performance of the strategy can vary based on market volatility. It may be helpful to evaluate performance in different market conditions or pair it with a filter like RSI or volume.
Let me know if you'd like further tweaks or explanations!
Reversal & Breakout Strategy with ORB### Reversal & Breakout Strategy with ORB
This strategy combines three distinct trading approachesโreversals, trend breakouts, and opening range breakouts (ORB)โinto a single, cohesive system. The goal is to capture high-probability setups across different market conditions, leveraging a mashup of technical indicators for confirmation and risk management. Below, Iโll explain why this combination works, how the components interact, and how to use it effectively.
#### Why the Mashup?
- **Reversals**: Identifies overextended moves using RSI (overbought/oversold) and SMA50 crosses, filtered by VWAP and SMA200 trend direction. This targets mean-reversion opportunities in trending markets.
- **Breakouts**: Uses EMA9/EMA20 crossovers with VWAP and SMA200 confirmation to catch momentum-driven trend continuations.
- **Opening Range Breakout (ORB)**: Detects early momentum by breaking the high/low of a user-defined opening range (default: 15 bars) with volume confirmation. This adds a time-based edge, ideal for intraday trading.
The synergy comes from blending these methods: reversals catch pullbacks, breakouts ride trends, and ORB exploits early volatilityโall filtered by trend (SMA200) and anchored by VWAP for context.
#### How It Works
1. **Indicators**:
- **EMA9/EMA20**: Fast-moving averages for breakout signals.
- **SMA50**: Medium-term trend filter for reversals.
- **SMA200**: Long-term trend direction to align trades.
- **RSI (14)**: Measures overbought (>70) or oversold (<30) conditions.
- **VWAP**: Acts as a dynamic support/resistance level.
- **ATR (14)**: Sets stop-loss distance (default: 1.5x ATR).
- **Volume**: Confirms ORB breakouts (1.5x average volume of opening range).
2. **Entry Conditions**:
- **Long**: Triggers on reversal (SMA50 cross + RSI < 30 + below VWAP + uptrend), breakout (EMA9 > EMA20 + above VWAP + uptrend), or ORB (break above opening range high + volume).
- **Short**: Triggers on reversal (SMA50 cross + RSI > 70 + above VWAP + downtrend), breakout (EMA9 < EMA20 + below VWAP + downtrend), or ORB (break below opening range low + volume).
3. **Risk Management**:
- Risks 5% of equity per trade (based on the initial capital set in the strategy tester).
- Stop-loss: Based on lowest low/highest high over 7 bars ยฑ 1.5x ATR.
- Targets: Two exits at 1:1 and 1:2 risk:reward (50% of position at each).
- Break-even: Stop moves to entry price after the first target is hit.
4. **Backtesting Settings**:
- Commission: Hardcoded at 0.1% per trade (realistic for most brokers).
- Slippage: Hardcoded at 2 ticks (realistic for most markets).
- Tested on datasets yielding 100+ trades (e.g., 2-min or 5-min charts over months).
#### How to Use It
- **Timeframe**: Works best on intraday (2-min, 5-min) or daily charts. Adjust `Opening Range Bars` (e.g., 15 bars = 30 min on 2-min chart) for your timeframe.
- **Settings**:
- Set your initial equity in the TradingView strategy testerโs "Properties" tab under "Initial Capital" (e.g., $10,000). The script automatically risks 5% of this equity per trade.
- Adjust `Stop Loss ATR Multiplier` or `Risk:Reward Targets` based on your risk tolerance.
- Note that commission (0.1%) and slippage (2 ticks) are fixed in the script for backtesting consistency.
- **Execution**: Enter on signal, monitor plotted stop (red) and targets (green/blue). The strategy supports pyramiding (up to 2 positions) for scaling into trends.
#### Backtesting Notes
Results are realistic with commission (0.1%) and slippage (2 ticks) included. For a sufficient sample, test on volatile instruments (e.g., stocks, forex) over 3-6 months on lower timeframes. The default 1.5x ATR stop may seem wide, but itโs justified to avoid premature exits in volatile marketsโfeel free to tweak it with justification. The script assumes an initial capital of $10,000 in the strategy tester for the 5% risk calculation (e.g., $500 risk per trade); adjust this in the "Properties" tab as needed.
This mashup isnโt just a random mix; itโs a deliberate fusion of complementary strategies, offering traders flexibility across market phases. Questions? Let me know!
StatPivot- Dynamic Range Analyzer - indicator [PresentTrading]Hello everyone! In the following few open scripts, I would like to share various statistical tools that benefit trading. For this time, it is a powerful indicator called StatPivot- Dynamic Range Analyzer that brings a whole new dimension to your technical analysis toolkit.
This tool goes beyond traditional pivot point analysis by providing comprehensive statistical insights about price movements, helping you identify high-probability trading opportunities based on historical data patterns rather than subjective interpretations. Whether you're a day trader, swing trader, or position trader, StatPivot's real-time percentile rankings give you a statistical edge in understanding exactly where current price action stands within historical contexts.
Welcome to share your opinions! Looking forward to sharing the next tool soon!
โ Introduction and How it is Different
StatPivot is an advanced technical analysis tool that revolutionizes retracement analysis. Unlike traditional pivot indicators that only show static support/resistance levels, StatPivot delivers dynamic statistical insights based on historical pivot patterns.
Its key innovation is real-time percentile calculation - while conventional tools require new pivot formations before updating (often too late for trading decisions), StatPivot continuously analyzes where current price stands within historical retracement distributions.
Furthermore, StatPivot provides comprehensive statistical metrics including mean, median, standard deviation, and percentile distributions of price movements, giving traders a probabilistic edge by revealing which price levels represent statistically significant zones for potential reversals or continuations. By transforming raw price data into statistical insights, StatPivot helps traders move beyond subjective price analysis to evidence-based decision making.
โ Strategy, How it Works: Detailed Explanation
๐ถ Pivot Point Detection and Analysis
The core of StatPivot's functionality begins with identifying significant pivot points in the price structure. Using the parameters left and right, the indicator locates pivot highs and lows by examining a specified number of bars to the left and right of each potential pivot point:
Copyp_low = ta.pivotlow(low, left, right)
p_high = ta.pivothigh(high, left, right)
For a point to qualify as a pivot low, it must have left higher lows to its left and right higher lows to its right. Similarly, a pivot high must have left lower highs to its left and right lower highs to its right. This approach ensures that only significant turning points are recognized.
๐ถ Percentage Change Calculation
Once pivot points are identified, StatPivot calculates the percentage changes between consecutive pivot points:
For drops (when a pivot low is lower than the previous pivot low):
CopydropPercent = (previous_pivot_low - current_pivot_low) / previous_pivot_low * 100
For rises (when a pivot high is higher than the previous pivot high):
CopyrisePercent = (current_pivot_high - previous_pivot_high) / previous_pivot_high * 100
These calculations quantify the magnitude of each market swing, allowing for statistical analysis of historical price movements.
๐ถ Statistical Distribution Analysis
StatPivot computes comprehensive statistics on the historical distribution of drops and rises:
Average (Mean): The arithmetic mean of all recorded percentage changes
CopyavgDrop = array.avg(dropValues)
Median: The middle value when all percentage changes are arranged in order
CopymedianDrop = array.median(dropValues)
Standard Deviation: Measures the dispersion of percentage changes from the average
CopystdDevDrop = array.stdev(dropValues)
Percentiles (25th, 75th): Values below which 25% and 75% of observations fall
Copyq1 = array.get(sorted, math.floor(cnt * 0.25))
q3 = array.get(sorted, math.floor(cnt * 0.75))
VaR95: The maximum expected percentage drop with 95% confidence
Copyvar95D = array.get(sortedD, math.floor(nD * 0.95))
Coefficient of Variation (CV): Measures relative variability
CopycvD = stdDevDrop / avgDrop
These statistics provide a comprehensive view of market behavior, enabling traders to understand the typical ranges and extreme moves.
๐ถ Real-time Percentile Ranking
StatPivot's most innovative feature is its real-time percentile calculation. For each current price, it calculates:
The percentage drop from the latest pivot high:
CopycurrentDropPct = (latestPivotHigh - close) / latestPivotHigh * 100
The percentage rise from the latest pivot low:
CopycurrentRisePct = (close - latestPivotLow) / latestPivotLow * 100
The percentile ranks of these values within the historical distribution:
CopyrealtimeDropRank = (count of historical drops <= currentDropPct) / total drops * 100
This calculation reveals exactly where the current price movement stands in relation to all historical movements, providing crucial context for decision-making.
๐ถ Cluster Analysis
To identify the most common retracement zones, StatPivot performs a cluster analysis by dividing the range of historical drops into five equal intervals:
CopyrangeSize = maxVal - minVal
For each interval boundary:
Copyboundaries = minVal + rangeSize * i / 5
By counting the number of observations in each interval, the indicator identifies the most frequently occurring retracement zones, which often serve as significant support or resistance areas.
๐ถ Expected Price Targets
Using the statistical data, StatPivot calculates expected price targets:
CopytargetBuyPrice = close * (1 - avgDrop / 100)
targetSellPrice = close * (1 + avgRise / 100)
These targets represent statistically probable price levels for potential entries and exits based on the average historical behavior of the market.
โ Trade Direction
StatPivot functions as an analytical tool rather than a direct trading signal generator, providing statistical insights that can be applied to various trading strategies. However, the data it generates can be interpreted for different trade directions:
For Long Trades:
Entry considerations: Look for price drops that reach the 70-80th percentile range in the historical distribution, suggesting a statistically significant retracement
Target setting: Use the Expected Sell price or consider the average rise percentage as a reasonable target
Risk management: Set stop losses below recent pivot lows or at a distance related to the statistical volatility (standard deviation)
For Short Trades:
Entry considerations: Look for price rises that reach the 70-80th percentile range, indicating an unusual extension
Target setting: Use the Expected Buy price or average drop percentage as a target
Risk management: Set stop losses above recent pivot highs or based on statistical measures of volatility
For Range Trading:
Use the most common drop and rise clusters to identify probable reversal zones
Trade bounces between these statistically significant levels
For Trend Following:
Confirm trend strength by analyzing consecutive higher pivot lows (uptrend) or lower pivot highs (downtrend)
Use lower percentile retracements (20-30th percentile) as entry opportunities in established trends
โ Usage
StatPivot offers multiple ways to integrate its statistical insights into your trading workflow:
Statistical Table Analysis: Review the comprehensive statistics displayed in the data table to understand the market's behavior. Pay particular attention to:
Average drop and rise percentages to set reasonable expectations
Standard deviation to gauge volatility
VaR95 for risk assessment
Real-time Percentile Monitoring: Watch the real-time percentile display to see where the current price movement stands within the historical distribution. This can help identify:
Extreme movements (90th+ percentile) that might indicate reversal opportunities
Typical retracements (40-60th percentile) that might continue further
Shallow pullbacks (10-30th percentile) that might represent continuation opportunities in trends
Support and Resistance Identification: Utilize the plotted pivot points as key support and resistance levels, especially when they align with statistically significant percentile ranges.
Target Price Setting: Use the expected buy and sell prices calculated from historical averages as initial targets for your trades.
Risk Management: Apply the statistical measurements like standard deviation and VaR95 to set appropriate stop loss levels that account for the market's historical volatility.
Pattern Recognition: Over time, learn to recognize when certain percentile levels consistently lead to reversals or continuations in your specific market, and develop personalized strategies based on these observations.
โ Default Settings
The default settings of StatPivot have been carefully calibrated to provide reliable statistical analysis across a variety of markets and timeframes, but understanding their effects allows for optimal customization:
Left Bars (30) and Right Bars (30): These parameters determine how pivot points are identified. With both set to 30 by default:
A pivot low must be the lowest point among 30 bars to its left and 30 bars to its right
A pivot high must be the highest point among 30 bars to its left and 30 bars to its right
Effect on performance: Larger values create fewer but more significant pivot points, reducing noise but potentially missing important market structures. Smaller values generate more pivot points, capturing more nuanced movements but potentially including noise.
Table Position (Top Right): Determines where the statistical data table appears on the chart.
Effect on performance: No impact on analytical performance, purely a visual preference.
Show Distribution Histogram (False): Controls whether the distribution histogram of drop percentages is displayed.
Effect on performance: Enabling this provides visual insight into the distribution of retracements but can clutter the chart.
Show Real-time Percentile (True): Toggles the display of real-time percentile rankings.
Effect on performance: A critical setting that enables the dynamic analysis of current price movements. Disabling this removes one of the key advantages of the indicator.
Real-time Percentile Display Mode (Label): Chooses between label display or indicator line for percentile rankings.
Effect on performance: Labels provide precise information at the current price point, while indicator lines show the evolution of percentile rankings over time.
Advanced Considerations for Settings Optimization:
Timeframe Adjustment: Higher timeframes generally benefit from larger Left/Right values to identify truly significant pivots, while lower timeframes may require smaller values to capture shorter-term swings.
Volatility-Based Tuning: In highly volatile markets, consider increasing the Left/Right values to filter out noise. In less volatile conditions, lower values can help identify more potential entry and exit points.
Market-Specific Optimization: Different markets (forex, stocks, commodities) display different retracement patterns. Monitor the statistics table to see if your market typically shows larger or smaller retracements than the current settings are optimized for.
Trading Style Alignment: Adjust the settings to match your trading timeframe. Day traders might prefer settings that identify shorter-term pivots (smaller Left/Right values), while swing traders benefit from more significant pivots (larger Left/Right values).
By understanding how these settings affect the analysis and customizing them to your specific market and trading style, you can maximize the effectiveness of StatPivot as a powerful statistical tool for identifying high-probability trading opportunities.
Penny King**Penny King Trend Indicator**
The **Penny King** is a powerful and versatile trend-following indicator designed to assist traders in identifying market trends and dynamic support/resistance levels. This tool effectively leverages Adaptive True Range (ATR) and Exponential Moving Average (EMA) or a Delta Price method to establish a trailing stop level, ensuring traders can capture strong trends while minimizing risk.
### **Key Features:**
1. **Dual Calculation Modes:**
- **ATR & EMA-Based Mode (Mode 0)**: Uses ATR (Average True Range) and EMA (Exponential Moving Average) to determine the trailing stop level dynamically.
- **Delta Price Mode (Mode 1)**: Utilizes a fixed price change threshold (Delta Price) to define stop levels based on market volatility.
2. **Adjustable Parameters for Customization:**
- **Range (akk_range)**: Defines the lookback period for the ATR calculation.
- **IMA Range (ima_range)**: Specifies the EMA smoothing factor applied to the ATR.
- **Factor (akk_factor)**: Multiplier applied to the ATR-based calculation to refine trailing stop sensitivity.
- **Delta Price (DeltaPrice)**: Fixed price-based stop level for an alternative trend calculation.
3. **Intelligent Trailing Stop Mechanism:**
- The trailing stop level dynamically adjusts based on price movement, following the trend while preventing premature exits.
- If the price moves in favor of the trend, the stop level is adjusted accordingly to lock in profits.
- If the price reverses against the trend, the stop level remains intact until a new trend direction is established.
4. **Efficient Market Adaptability:**
- The ATR-based method ensures adaptability to changing market conditions, expanding stop levels in high volatility and tightening them in low volatility periods.
- The Delta Price method offers a fixed approach, ideal for traders who prefer a non-ATR-based system for managing stop levels.
5. **Clean Visual Representation:**
- The indicator plots a clear, orange-colored trend stop line that dynamically follows the market movement.
- Provides a visual cue to determine potential entry and exit points efficiently.
### **How to Use:**
- **Trend Confirmation:**
- If the price remains above the trend stop line, it signals a bullish trend.
- If the price falls below the trend stop line, it indicates a bearish trend.
- **Trade Entries & Exits:**
- Consider long positions when the price remains above the trend stop.
- Consider short positions when the price stays below the trend stop.
- Utilize the trend stop line as a dynamic trailing stop-loss mechanism to protect gains and minimize losses.
- **Parameter Optimization:**
- Adjust the **Range**, **IMA Range**, and **Factor** to optimize settings based on the trading asset and time frame.
- Experiment with **Delta Price Mode** for assets where fixed price-based trailing stops are more effective.
### **Conclusion:**
The **Penny King Trend Indicator** is an essential tool for traders looking to capture market trends while ensuring effective risk management. Whether you prefer ATR-based adaptability or a fixed price stop approach, this indicator provides the flexibility needed to navigate different market conditions successfully. By integrating the **Penny King**, traders can enhance their trading strategy with a reliable and efficient trend-following system.
Custom Support & Resistance with 3 LevelsThis Pine Script indicator calculates and displays three levels of support and resistance based on the opening price of the first bar of the day.
Here's how it works:
Identifies the Day's Open: The indicator first determines the opening price of the trading day. It does this by checking if the current bar's day is different from the previous bar's day. If it is, it stores the current bar's opening price as the day's opening price.
Calculates Support and Resistance: The user provides six input values: three for calculating resistance levels and three for calculating support levels. These values are added to or subtracted from the day's opening price to determine the three support and resistance levels.
Plots the Levels: The indicator then plots these six levels on the chart as horizontal lines. Resistance levels are typically plotted in shades of red, orange, and yellow, while support levels are plotted in shades of green, blue, and purple.
Key Features:
Day-Based Calculation: The support and resistance levels are anchored to the opening price of the day, providing a consistent reference point regardless of intraday price fluctuations.
Multiple Levels: The indicator provides three levels each for support and resistance, giving traders a broader perspective on potential price turning points.
Customizable: Traders can adjust the values used to calculate the support and resistance levels, allowing for flexibility and adaptation to different trading styles and markets.
Potential Use Cases:
Identifying Entry and Exit Points: Traders can use the support and resistance levels to identify potential entry points for long trades (near support) and short trades (near resistance), as well as exit points for existing positions.
Setting Stop-Loss Orders: The support and resistance levels can be used to set stop-loss orders to limit potential losses.
Gauging Trend Strength: A strong break above a resistance level can indicate bullish momentum, while a break below a support level can suggest bearish pressure.
This indicator can be a valuable tool for traders seeking to incorporate support and resistance levels into their technical analysis. However, it's important to remember that these levels are not absolute guarantees of price reversals and should be used in conjunction with other technical indicators and risk management strategies.
Supertrend and Fast and Slow EMA StrategyThis strategy combines Exponential Moving Averages (EMAs) and Average True Range (ATR) to create a simple, yet effective, trend-following approach. The strategy filters out fake or sideways signals by incorporating the ATR as a volatility filter, ensuring that trades are only taken during trending conditions. The key idea is to buy when the short-term trend (Fast EMA) aligns with the long-term trend (Slow EMA), and to avoid trades during low volatility periods.
How It Works:
EMA Crossover:
1). Buy Signal: When the Fast EMA (shorter-term, e.g., 20-period) crosses above the Slow EMA (longer-term, e.g., 50-period), this indicates a potential uptrend.
2). Sell Signal: When the Fast EMA crosses below the Slow EMA, this indicates a potential downtrend.
ATR Filter:
1). The ATR (Average True Range) is used to measure market volatility.
2). Trending Market: If the ATR is above a certain threshold, it indicates high volatility and a trending market. Only when ATR is above the threshold will the strategy generate buy/sell signals.
3). Sideways Market: If ATR is low (sideways or choppy market), the strategy will suppress signals to avoid entering during non-trending conditions.
When to Buy:
1). Condition 1: The Fast EMA crosses above the Slow EMA.
2). Condition 2: The ATR is above the defined threshold, indicating that the market is trending (not sideways or choppy).
When to Sell:
1). Condition 1: The Fast EMA crosses below the Slow EMA.
2). Condition 2: The ATR is above the defined threshold, confirming that the market is in a downtrend.
When Not to Enter the Trade:
1). Sideways Market: If the ATR is below the threshold, signaling low volatility and sideways or choppy market conditions, the strategy will not trigger any buy or sell signals.
2). False Crossovers: In low volatility conditions, price action tends to be noisy, which could lead to false signals. Therefore, avoiding trades during these periods reduces the risk of false breakouts.
Additional Factors to Consider Adding:
=> RSI (Relative Strength Index): Adding an RSI filter can help confirm overbought or oversold conditions to avoid buying into overextended moves or selling too low.
1). RSI Buy Filter: Only take buy signals when RSI is below 70 (avoiding overbought conditions).
2). RSI Sell Filter: Only take sell signals when RSI is above 30 (avoiding oversold conditions).
=> MACD (Moving Average Convergence Divergence): Using MACD can help validate the strength of the trend.
1). Buy when the MACD histogram is above the zero line and the Fast EMA crosses above the Slow EMA.
2). Sell when the MACD histogram is below the zero line and the Fast EMA crosses below the Slow EMA.
=> Support/Resistance Levels: Adding support and resistance levels can help you understand market structure and decide whether to enter or exit a trade.
1). Buy when price breaks above a significant resistance level (after a valid buy signal).
2). Sell when price breaks below a major support level (after a valid sell signal).
=> Volume: Consider adding a volume filter to ensure that buy/sell signals are supported by strong market participation. You could only take signals if the volume is above the moving average of volume over a certain period.
=> Trailing Stop Loss: Instead of a fixed stop loss, use a trailing stop based on a percentage or ATR to lock in profits as the trade moves in your favor.
=> Exit Signals: Besides the EMA crossover, consider adding Take Profit or Stop Loss levels, or even using a secondary indicator like RSI to signal an overbought/oversold condition and exit the trade.
Example Usage:
=> Buy Example:
1). Fast EMA (20-period) crosses above the Slow EMA (50-period).
2). The ATR is above the threshold, confirming that the market is trending.
3). Optionally, if RSI is below 70, the buy signal is further confirmed as not being overbought.
=> Sell Example:
1). Fast EMA (20-period) crosses below the Slow EMA (50-period).
2). The ATR is above the threshold, confirming that the market is trending.
3). Optionally, if RSI is above 30, the sell signal is further confirmed as not being oversold.
Conclusion:
This strategy helps to identify trending markets and filters out sideways or choppy market conditions. By using Fast and Slow EMAs combined with the ATR volatility filter, it provides a reliable approach to catching trending moves while avoiding false signals during low-volatility, sideways markets.
Supertrend with 1% Target and 1% StoplossSupertrend Calculation: The Supertrend indicator is calculated using the Average True Range (ATR) and a factor. The factor and ATR length can be adjusted in the inputs.
Long and Short Conditions: The strategy enters a long position when the price crosses above the Supertrend line and a short position when the price crosses below it.
Target and Stop Loss: The strategy places a 1% target and a 1% stop loss for both long and short positions.
Visuals: The stop loss and take profit levels are plotted on the chart for better visibility.
Enhanced Doji Candle StrategyYour trading strategy is a Doji Candlestick Reversal Strategy designed to identify potential market reversals using Doji candlestick patterns. These candles indicate indecision in the market, and when detected, your strategy uses a Simple Moving Average (SMA) with a short period of 20 to confirm the overall market trend. If the price is above the SMA, the trend is considered bullish; if it's below, the trend is bearish.
Once a Doji is detected, the strategy waits for one or two consecutive confirmation candles that align with the market trend. For a bullish confirmation, the candles must close higher than their opening price without significant bottom wicks. Conversely, for a bearish confirmation, the candles must close lower without noticeable top wicks. When these conditions are met, a trade is entered at the market price.
The risk management aspect of your strategy is clearly defined. A stop loss is automatically placed at the nearest recent swing high or low, with a tighter distance of 5 pips to allow for more trading opportunities. A take-profit level is set using a 2:1 reward-to-risk ratio, meaning the potential reward is twice the size of the risk on each trade.
Additionally, the strategy incorporates an early exit mechanism. If a reversal Doji forms in the opposite direction of your trade, the position is closed immediately to minimize losses. This strategy has been optimized to increase trade frequency by loosening the strictness of Doji detection and confirmation conditions while still maintaining sound risk management principles.
The strategy is coded in Pine Script for use on TradingView and uses built-in indicators like the SMA for trend detection. You also have flexible parameters to adjust risk levels, take-profit targets, and stop-loss placements, allowing you to tailor the strategy to different market conditions.
Grim SlashOverview:
The Touch Previous Candle Strategy is a simple yet effective trading approach designed for the 1-hour chart. It focuses on price action by placing trades when the current candle interacts with key levels from the previous candle. The strategy is fully automated and includes risk management with take profit and stop loss levels.
Entry Conditions:
Buy Signal: A buy order is triggered when the low of the current candle touches or drops below the previous candle's closing price.
Sell Signal: A position is closed when the high of the current candle reaches or exceeds the previous candle's highest price.
Risk Management:
Take Profit: The trade is exited automatically when the price increases by 15% from the entry point.
Stop Loss: A stop loss is set at 5% below the entry price to minimize risk.
Best Use Cases:
Works well in volatile markets where price frequently tests previous levels.
Suitable for traders who prefer price-action-based strategies over indicators.
Can be optimized for different assets or timeframes based on market behavior.
Money Flow Indicator (Chaikin Oscillator) with VWAPStrategy Overview
Entry Conditions:
Buy Entry:
The Chaikin Oscillator crosses above the signal line.
The current price is above the VWAP.
Sell Entry:
The Chaikin Oscillator crosses below the signal line.
The current price is below the VWAP.
Exit Conditions:
Profit Taking:
Take profit when a target profit is reached (e.g., a 2% increase from the entry price).
Stop Loss:
Set a stop loss, for example, at a 1% decline from the entry price.
Risk Management:
Manage risk by limiting each trade to no more than 1-2% of the account balance.
Calculate position size based on risk and trade accordingly.
Trend Confirmation:
Use other indicators (like moving averages) to confirm the overall trend and focus trades in the direction of the trend.
In an uptrend, prioritize buy entries; in a downtrend, prioritize sell entries.
Specific Trade Scenarios
Example 1: Buy Entry:
Enter a buy position when the Chaikin Oscillator crosses above the signal line and the price is above the VWAP.
Set a stop loss 1% below the entry price and a profit target 2% above the entry price.
Example 2: Sell Entry:
Enter a sell position when the Chaikin Oscillator crosses below the signal line and the price is below the VWAP.
Set a stop loss 1% above the entry price and a profit target 2% below the entry price.
Additional Considerations
Backtesting: Test this strategy with historical data to evaluate performance and make adjustments as needed.
Market Conditions: Pay attention to market volatility and economic indicators, adjusting the trading strategy flexibly.
Psychological Factors: Avoid emotional decisions and follow clear rules when trading.
ATR Levels and Zones with Signals๐ ATR Levels and Zones with Signals โ User Guide Description
๐น Overview
The ATR Levels and Zones with Signals indicator is a volatility-based trading tool that helps traders identify:
โ Key support & resistance levels based on ATR (Average True Range)
โ Buy & Sell signals triggered when price enters key ATR zones
โ Breakout confirmations to detect high-momentum moves
โ Dynamic Stop-Loss & Take-Profit suggestions
Unlike traditional ATR bands, this indicator creates layered ATR zones based on multiple ATR multipliers, allowing traders to gauge volatility and risk-adjust their trading strategies.
๐น How It Works
๐ธ The script calculates a baseline SMA (Simple Moving Average) of the price.
๐ธ ATR (Average True Range) is then used to create six dynamic price levels above & below the baseline.
๐ธ These levels define different risk zonesโhigher levels indicate increased volatility and potential trend exhaustion.
๐ ATR Zones Explained
๐น Lower ATR Levels (Buying Opportunities)
๐ Lower Level 1-2 โ Mild Oversold Zone (Potential trend continuation)
๐ Lower Level 3-4 โ High Volatility Buy Zone (Aggressive traders start scaling in)
๐ Lower Level 5-6 โ Extreme Oversold Zone (High-Risk Reversal Area)
๐น If price enters these lower zones, it may indicate a potential buying opportunity, especially if combined with trend reversal confirmation.
๐น Upper ATR Levels (Selling / Take Profit Zones)
๐ Upper Level 1-2 โ Mild Overbought Zone (Potential pullback area)
๐ Upper Level 3-4 โ High Volatility Sell Zone (Aggressive traders start scaling out)
๐ Upper Level 5-6 โ Extreme Overbought Zone (High-Risk for Reversal)
๐น If price enters these upper zones, it may indicate a potential selling opportunity or trend exhaustion, especially if momentum slows.
๐น Sensitivity Modes
๐น Aggressive Mode (More Frequent Signals) โ Triggers buy/sell signals at Lower/Upper Level 3 & 4
๐น Conservative Mode (Stronger Confirmation) โ Triggers buy/sell signals at Lower/Upper Level 5 & 6
๐ Choose the mode based on your trading style:
โ Scalpers & short-term traders โ Use Aggressive Mode
โ Swing & trend traders โ Use Conservative Mode for stronger confirmations
๐ How to Use the Indicator
๐น For Trend Trading:
โ
Buy when price enters the lower ATR zones (especially in uptrends).
โ
Sell when price enters the upper ATR zones (especially in downtrends).
๐น For Breakout Trading:
โ
Breakout Buy: Price breaks above Upper ATR Level 3 โ Momentum entry for trend continuation
โ
Breakout Sell: Price breaks below Lower ATR Level 3 โ Momentum short opportunity
๐น Stop-Loss & Take-Profit Suggestions
๐จ Stop-Loss: Suggested at Lower ATR Level 6 (for longs) or Upper ATR Level 6 (for shorts)
๐ฏ Take-Profit: Suggested at Upper ATR Level 3 (for longs) or Lower ATR Level 3 (for shorts)
๐น Why This Indicator is Unique
โ Multiple ATR layers for better risk-adjusted trading decisions
โ Combines ATR-based zones with SMA trend confirmation
โ Both aggressive & conservative trading modes available
โ Includes automatic stop-loss & take-profit suggestions
โ Breakout signals for momentum traders
๐ข Final Notes
โ
Free & open-source for the TradingView community!
โ Risk Warning: Always confirm signals with other confluences (trend, volume, support/resistance) before trading.
๐ Developed by: Maddog Blewitt
๐ฉ Feedback & improvements are welcome! ๐